Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/io/cat.sh

cat

Since 0.3.0 · Source

import "{ cat }" from nice_things/io/cat.sh

Synopsis
cat [-u] [--] [<file>…]

Configuration

Description
Concatenate <file>(s) to stdout. With no <file>, or when <file> is -, read stdin.

This function is a simple POSIX-compatible cat utility in pure shell script.

Note

This function only exists to provide a pure sh implementation. cat is a very basic core utility and is always likely to be available and will be much faster than this function. You should prefer the platform's cat command over this function in most cases.

Options

  • -u: Ignored.
  • --: End of options.

Operands
<file>: Optional file to read, or - to read stdin.

Stdin
Stdin will be read when no <file> parameter is specified, or when <file> is -.

Stdout
Will echo all files' contents to stdout.

Stderr

Exit status
0: Successful completion.

Abort

Usage examples

cat /path/to/file